package com.lihepeng.leecode.design_patten.dynamic_proxy;

import java.lang.reflect.Proxy;

/**
 * jdk 动态代理
 * 2022年5月5日
 */
public class JdkProxyDemo {
    public static void main(String[] args) {
        AService aService = new AServiceImpl();
        MyInvocationHandler myInvocationHandler = new MyInvocationHandler(aService);
        AService proxyInstance = (AService)Proxy.newProxyInstance(aService.getClass().getClassLoader(), aService.getClass().getInterfaces(),myInvocationHandler);
        proxyInstance.func1();
    }
}
